import 'package:flutter/material.dart';

class Orderdetail extends StatelessWidget {
  const Orderdetail({super.key});

  @override
  Widget build(BuildContext context) {
    final Map<String, dynamic>? arguments =
        ModalRoute.of(context)?.settings.arguments as Map<String, dynamic>?;
    final String? name = arguments?['name'];
    final int? id = arguments?['productId'];
    ModalRoute? modalRoute = ModalRoute.of(context);
    print(modalRoute?.settings.arguments);
    return Scaffold(
      appBar: AppBar(title: const Text('订单详情')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('商品ID: $id'),
            Text('商品名称: $name'),
            ElevatedButton(
              onPressed: () {
                Navigator.pop(context);
              },
              child: const Text('回到列表页'),
            ),
          ],
        ),
      ),
    );
  }
}
